package com.itheima.stock.mapper;

import com.itheima.stock.pojo.SysRolePermission;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

/**
* @author hyn
* @description 针对表【sys_role_permission(角色权限表)】的数据库操作Mapper
* @createDate 2022-05-30 01:02:49
* @Entity com.itheima.stock.pojo.SysRolePermission
*/
public interface SysRolePermissionMapper {

    int deleteByPrimaryKey(Long id);

    int insert(SysRolePermission record);

    int insertSelective(SysRolePermission record);

    SysRolePermission selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(SysRolePermission record);

    int updateByPrimaryKey(SysRolePermission record);

    @Select("select permission_id from sys_role_permission where role_id =#{rid}")
    List<String> getAllPidByRoleId(@Param("rid") String roleId);

    @Delete("delete from sys_role_permission where role_id=#{rid}")
    boolean deleteByRid(@Param("rid") Long id);

    @Insert("insert into sys_role_permission values (#{id},#{rid},#{pid},#{ctime})")
    boolean insertPersissonByRid(@Param("id") long nextId, @Param("rid") Long id,@Param("pid") String permissionsId, @Param("ctime") Date date);
}
